<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>后台登录</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/admin/css/login.css"/>

</head>

<body>
<div class="m-login-bg">
    <div class="m-login">
        <h3>OA审批系统后台</h3>
        <div class="m-login-warp">
            <form class="layui-form">
                <div class="layui-form-item">
                    <input type="text" name="userName" required lay-verify="required" placeholder="用户名"
                           autocomplete="off"
                           class="layui-input">
                </div>
                <div class="layui-form-item">
                    <input type="password" name="password" required lay-verify="required" placeholder="密码"
                           autocomplete="off" class="layui-input">
                </div>
<!--                <div class="layui-form-item">-->
<!--                    <div class="layui-inline">-->
<!--                        <input type="text" name="verity" required lay-verify="required" placeholder="验证码"-->
<!--                               autocomplete="off" class="layui-input">-->
<!--                    </div>-->
<!--                    <div class="layui-inline">-->
<!--                        <img class="verifyImg" onclick="this.src=this.src+'?c='+Math.random();"-->
<!--                             src="../../static/admin/images/login/yzm.jpg"/>-->
<!--                    </div>-->
<!--                </div>-->
                <div class="layui-form-item m-login-btn">
                    <div class="layui-inline">
                        <button type="button" class="layui-btn layui-btn-normal" lay-submit lay-filter="login">登录
                        </button>
                    </div>
                    <div class="layui-inline">
                        <button type="reset" class="layui-btn layui-btn-primary">取消</button>
                    </div>
                </div>
            </form>
        </div>
        <p class="copyright">Copyright 2015-2016 by XIAODU</p>
    </div>
</div>
<script src="../../static/admin/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery-1.7.2.min.js"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form(),
            layer = layui.layer;
        form.on('submit(login)', function (data) {
            var load_index = layer.load(0, {shade: [0.2, '#393D49']});
            $.ajax(ip + 'login/login', {
                dataType: 'json',
                type: 'post',
                data: data.field
            }).done(function (data) {
                layer.close(load_index);
                if (data.code == '0') {
                    // layer.alert(data.message, {
                    //     icon: 1,
                    //     title: "提示"
                    // });
                    window.location = './index.html';
                } else {
                    layer.alert(data.message, {
                        icon: 5,
                        title: "提示"
                    });
                }
            })
            return false;
        });
    });
</script>
</body>

</html>